/*
 * Copyright (c) 2006-2020, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2020-07-29     RT-Thread    first version
 */

#include <rtthread.h>
#include <rtdevice.h>
#include "drv_common.h"


#define DBG_TAG "main"
#define DBG_LVL DBG_LOG
#define LEDR GET_PIN(E , 5)
#define LEDG GET_PIN(E , 6)
#include <rtdbg.h>

int main(void)
{
    int count = 1;
    rt_device_t dev = RT_NULL;
    char buf[] = "hello rt-thread!\r\n";
    __HAL_RCC_GPIOE_CLK_ENABLE();
    rt_pin_mode(LEDR , PIN_MODE_OUTPUT);
    rt_pin_mode(LEDG , PIN_MODE_OUTPUT);
    dev = rt_device_find("vcom");
    if (dev)
        rt_device_open(dev, RT_DEVICE_FLAG_RDWR);
    else
        return -RT_ERROR;
    while (count++)
    {
        LOG_D("Hello RT-Thread!");
        rt_thread_mdelay(1000);
        rt_pin_write(LEDR , count % 2);
        rt_pin_write(LEDG , count % 2);
    }

    return RT_EOK;
}
